#include <cmath>

#include <auxiliares.h>

bool esCero(double valor)
{
	return fabs(valor) < PRECISION_CERO;
}

bool esMaximo(int valor, int valor_pixel_max)
{
	int inf = valor_pixel_max - (valor_pixel_max * PORCENT_TOLERADO)/100;
	int sup = valor_pixel_max + (valor_pixel_max * PORCENT_TOLERADO)/100;
	return (inf <= valor && valor <= sup);
}

double norma_2(tripla_dbl v)
{
	return sqrt(v.fst()*v.fst() + v.snd()*v.snd() + v.trd()*v.trd());
}

void imprimirVector(vector<double> &v)
{
	cout << "(" ;
	
	unsigned int k;
	for(k = 0; k < v.size() - 1; k++)
		cout << v[k] << ", ";
		
	cout << v[k] << ")" << endl;
}

void imprimirVector(vector< pair<unsigned int,double> > &v){
 cout<<"(";
 for(unsigned int k=0; k<v.size(); k++){
	
	if(k==v.size()-1){
	 cout<<v[k].second<<") ";
 	}else{
 		cout<<v[k].second<<", ";
 	}
}
}
	
	
